package com.example.books.Controller;

import com.example.books.Pojo.InformationDO;
import com.example.books.Service.InformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
public class InformationController {

    @Autowired
    private InformationService informationService;

    @PostMapping("/get")
    public List<InformationDO> getInformation(){
        return informationService.getInformation();
    }

    @PostMapping("/setInformation")
    public boolean setInformation(@RequestBody Map<String,Object> map){
        return informationService.setInformation(map);
    }

    @PostMapping("/updateInformation")
    public boolean updateInformation(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return informationService.updateInformation(map);
    }

    @PostMapping("/deleteInformation")
    public boolean deleteInformation(@RequestBody Map<String, Object> map){
        System.out.println(map);
        return informationService.deleteInformation(map);
    }

}
